<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      const user = {
        firstName: "chen",
        lastName: "jack",
        gender: "2",
        get genderCN() {
          // 中国
          const g = { 1: "男", 2: "女" };
          return g[this.gender];
        },
        set genderCN(value) {
          const g = { 男: "1", 女: "2" };
          this.gender = g[value];
        },
      };
      console.log(user.genderCN);
      user.genderCN = "男";
      console.log(user.genderCN);
    </script>
  </body>
</html>
